home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------------
- // File : test3D.c
- // Date : July 23, 1994
- // Author : Jim Stout
- // :
- // Purpose : Test code for the 3D cdef
- //----------------------------------------------------------------------------------
- #include "debugCDEF.h"
- #include "TogLib.h"
- #include "movableModal.h"
-
- #define sCK1 3
- #define sCK2 4
- #define sRB1 5
- #define sRB2 6
-
- #define PB1 7
- #define PB2 8
-
- #define CK1 9
- #define CK2 10
- #define RB1 11
- #define RB2 12
-
- #define LAST 25
-
- extern pascal void CDmain(); // entry point to CDEF in cdef3D.c
-
- main()
- {
- CJMPhdl ch;
- DialogPtr theDialog;
- short itemHit,t,i;
- Rect r;
- Point p;
- ControlHandle h;
- Boolean inactive=false;
-
- InitGraf(&qd.thePort);
- InitWindows();
- InitFonts();
- InitMenus();
- TEInit();
- InitCursor();
- InitDialogs(0L);
-
- ch = (CJMPhdl)GetResource('CJMP',128);
- if(ch) {
- (**ch).cdefPtr = (long*)CDmain;
- ChangedResource((Handle)ch);
- }
- else
- ExitToShell();
-
- theDialog = GetNewDialog(128,0L,(DialogPtr)-1);
- if(theDialog) {
- SetPort(theDialog);
-
- PenPat(&gray);
-
- // TextFont(geneva);
- // TextSize(9);
-
- GetDItem(theDialog, sCK1, &t, (Handle *)&h, &r);
- if(h)
- SetCtlValue(h,!GetCtlValue(h));
-
- GetDItem(theDialog, sRB1, &t, (Handle *)&h, &r);
- if(h)
- SetCtlValue(h,!GetCtlValue(h));
-
- ShowWindow(theDialog);
-
- do {
- movableModalDialog(nil,&itemHit);
- switch(itemHit) {
-
- case CK1:
- case CK2:
- case sCK1:
- case sCK2:
- GetDItem(theDialog, itemHit, &t, (Handle *)&h, &r);
- if(h)
- SetCtlValue(h,!GetCtlValue(h));
- break;
-
- case RB1:
- case RB2:
- setRadioButtons(theDialog,itemHit,RB1,RB2);
- break;
-
- case sRB1:
- case sRB2:
- setRadioButtons(theDialog,itemHit,sRB1,sRB2);
- break;
- case PB1:
- for(i=sCK1;i<=LAST;i++) {
- if(i == PB1)
- continue;
- GetDItem(theDialog, i, &t, (Handle *)&h, &r);
- if(inactive)
- HiliteControl(h, 0);
- else
- HiliteControl(h, 0xFF);
- }
- inactive = !inactive;
- break;
- }
- }while(itemHit != 1 && itemHit != 2);
- DisposDialog(theDialog);
- }
- }
-
- // dummy routines needed by movableModal.c
-
- extern void doUpdate (EventRecord * theEvent);
- extern void doPeriodicEvent (EventRecord * theEvent);
- extern void doMenuCommand (long menuResult);
- extern void doUpdate (EventRecord * theEvent)
- {
- }
- extern void doPeriodicEvent (EventRecord * theEvent)
- {
- }
- extern void doMenuCommand (long menuResult)
- {
- }
-